package com.wenhai.spring.bean.lifecycle;

import com.wenhai.xiaomage.spring.ioc.overview.dependency.domain.User;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * @Author:wenhai
 * @Description: BeanDefinition合并示例
 * @Date:2020/3/16
 */
public class MergeBeanDefinitionDemo {
    public static void main(String[] args) {
        DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
        String location = "/META-INF/dependency-lookup-context.xml";
        reader.loadBeanDefinitions(location);
        User user = beanFactory.getBean("user", User.class);
        User user2 = beanFactory.getBean("superUser", User.class);

    }
}
